package com.yand.jdk8.common;

import java.util.List;


/**
 * 默认的类加载器的实现
 *
 *
 */
public class DefaultClassScanner implements ClassScanner {
    @Override
    public List<Class<?>> getClassListByPackageName(String packageUrl) {
        return new ClassTemplate(packageUrl) {
            @Override
            public boolean checkAddClass(Class<?> cls) {
                String className = cls.getName();
                String pkgName = className.substring(0, className.lastIndexOf("."));
                return pkgName.startsWith(packageName);
            }
        }.getClassList();
    }
}
